Change [IU]256 arithmetic host functions to take *Val not *Object. #889
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes the 256bit host arithmetic functions to take and return the Val versions rather than the Object versions. The purpose is to let the SDK ignore the small-vs-large case distinctions and just pass the values to the host, because 3 of the 4 cases in a binary arithmetic operator will involve an object anyways, and it's just needless code bloat to do the 4-way-switch in the guest.
I also added a bunch of convenience infallible const member functions on
[IU]{64,128,256}Small
types to allow constructing them directly from[iu]32
to make it cheaper in contracts that want "small bignum" immediates like 0, +/- 1 or whatever.PR is still waiting on a change @dmkozh is working on to adapt the test wasms to allow regeneration, but otherwise I think it's mostly in the right shape. cc @jayz22